package com.ait.edu.controller.front;


import com.ait.commonutils.Msg;
import com.ait.edu.entity.Teacher;
import com.ait.edu.service.TeacherService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/eduservice/Front")
public class TeacherFrontController {

    @Autowired
    private TeacherService teacherService;

    @ApiOperation("分页")
    @GetMapping("pageTeacher")
    public Msg edulimitcc(Integer currnet, Integer limit){
        Page<Teacher> page = new Page<>(currnet,limit);
        Map<String,Object> map = teacherService.getpage(page);
        if (map.get("items")!=null) {
            return Msg.success().data(map);
        }
        return Msg.fail();

    }


    @GetMapping("getTeacherById")
    public Msg TeacherFrontInfo(String id){
        Map<String,Object> map = teacherService.getCourseTeacher(id);

        return Msg.success().data(map);
    }



}
